package com.fz.entity;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;


/**
 * Created by webrx on 2017-09-08.
 */
@Data //@Component 通用组件 //@Controller 控制器 //@Service 业务 @Repository 数据库层
//@Repository("bk")
@Repository @Scope("prototype")  //@Scope("singleton") //@Lazy(true)
public class Book {
    @Value("100")
    private int id;
    @Value("jack")
    private String name;

    //@Resource(name="teacher")
    @Autowired
    //@Resource
    public Teacher teacher;

    public Book() {
        System.out.println("构造方法");
    }

    @PreDestroy
    public void closea(){
        System.out.println("closea()");
    }

    @PreDestroy
    public void closeb(){
        System.out.println("closeb()");
    }

    @PostConstruct
    public void inita() {
        System.out.println("inita()");
    }

    @PostConstruct
    public void initb() {
        System.out.println("initb()");
    }

    @PostConstruct
    public void initc() {
        System.out.println("initc()");
    }

}
